<?php
defined('SYS_RUN') or exit();

abstract class AController {

    static $_instance = array();

    function __get($name) {
        if(!isset(self::$_instance[$name])) {
            $instance = null;
            if($name == 'response') {
                if(Sys::isCli())
                    $instance = Lib::get('response.RCli');
                else $instance = Lib::get('response.RHttp');
            } else $instance = Lib::get($name);
            self::$_instance[$name] = $instance;
        }
        return self::$_instance[$name];
    }

    protected function render($template, $params = null, $layout = null) {
        Lib::get('template')->render($template, $params, $layout);
    }
}